<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('扫描批次列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li class="select-time">
                                <p>交易日期</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="beginTrDate"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endTrDate"/>
                            </li>
                            <li>
                                <p>机构号</p>
                                <input name="orgCode" onclick="selectDeptTree()" id="treeId" type="text" placeholder="请选择" class="form-control" required>
                            </li>
                            <li>
                                <p>批次种类</p>
                                <select name="parentId" th:with="type=${@dict.getType('sdi_paea_arc_parent_id')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>柜员号</p>
                                <input type="text" name="tellerCode"/>
                            </li>
                            <li>
                                <p>扫描员</p>
                                <input type="text" name="createor"/>
                            </li>
                            <li>
                                <p>补录员</p>
                                <input type="text" name="inputer"/>
                            </li>
                            <li>
                                <p>当前操作员</p>
                                <input type="text" name="capturer"/>
                            </li>
                            <li>
                                <p>强制补录员</p>
                                <input type="text" name="forceInputer"/>
                            </li>
                            <li>
                                <p>状态</p>
                                <select name="status" th:with="type=${@dict.getType('sdi_paea_arc_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>特殊状态</p>
                                <select name="statusCode" th:with="type=${@dict.getType('sdi_paea_arc_status_code')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="sdi:sdiPaeaArc:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="sdi:sdiPaeaArc:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>-->
                <a class="btn btn-success single disabled" onclick="unlock()" shiro:hasPermission="sdi:sdiPaeaArc:unlock">
                    <i class="fa fa-lock"></i> 解锁
                </a>
                <a class="btn btn-primary single disabled" onclick="callBack()" shiro:hasPermission="sdi:sdiPaeaArc:callBack">
                    <i class="fa fa-lock"></i> 回退
                </a>
                <a class="btn btn-primary single disabled" onclick="callBackToUser()" shiro:hasPermission="sdi:sdiPaeaArc:callBack">
                    <i class="fa fa-lock"></i> 回退至指定人员
                </a>
                <a class="btn btn-info single disabled" onclick="reInput()" shiro:hasPermission="sdi:sdiPaeaArc:reInput">
                    <i class="fa fa-lock"></i> 重新补录
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sdi:sdiPaeaArc:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="sdi:sdiPaeaArc:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-warning" onclick="$.operate.detailTab()" shiro:hasPermission="sdi:sdiPaeaArc:detail">
                    <i class="fa fa-download"></i> 详情
                </a>
                <a class="btn btn-warning" onclick="manualInputDetail()" shiro:hasPermission="sdi:manualInput:detail">
                    <i class="fa fa-download"></i> 补录详情
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <div id="callBackModel" style="display: none">
         <div name="content">
             <form id="callBack_form" class="form-horizontal">
                 <div class="form-group">
                     <label for="callBackToInputer" required class="col-sm-2 control-label">回退至:</label>
                     <div class="col-sm-9">
                         <input type="text" id="callBackToInputer" name="locker" class="form-control" placeholder="请输入要回退到的工号，空则回退至待获取状态">
                     </div>
                 </div>
             </form>
         </div>
         <div name="foot">
             <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
             <button type="button" class="btn btn-primary" onclick="callBackToUserConfirm()">提交</button>
         </div>
    </div>
    <th:block th:include="include :: footer" />
</body>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('sdi:sdiPaeaArc:edit')}]];
    var removeFlag = [[${@permission.hasPermi('sdi:sdiPaeaArc:remove')}]];
    var reStatusDatas = [[${@dict.getType('sdi_paea_arc_re_status')}]];
    var typeDatas = [[${@dict.getType('sdi_paea_arc_type')}]];
    var statusDatas = [[${@dict.getType('sdi_paea_arc_status')}]];
    var statusCodeDatas = [[${@dict.getType('sdi_paea_arc_status_code')}]];
    var parentIdDatas = [[${@dict.getType('sdi_paea_arc_parent_id')}]];
    var deptDatas = [[${@paeaConstants.DEPT_LIST}]];
    var userDatas = [[${@paeaConstants.USER_LIST}]];
    var prefix = ctx + "sdi/sdiPaeaArc";
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            detailUrl: prefix + "/detail/{id}",
            modalName: "扫描批次",
            //启用跳转至指定页
            showPageGo: true,
            //启用点击选中行
            clickToSelect: true,
            columns: [{
                radio: true
            },
                {
                    field : 'id',
                    title : '主键',
                    visible: false
                },
                {
                    field : 'trDate',
                    title : '交易日期'
                },
                {
                    field : 'orgCode',
                    title : '机构号',
                    formatter: function(value, row, index) {
                        return $.table.selectDeptLabel(deptDatas, value);
                    }
                },
                {
                    field : 'tellerCode',
                    title : '柜员号'
                },
                {
                    field : 'frontNum',
                    title : '正面总数'
                },
                {
                    field : 'ocrRate',
                    title : '识别率'
                },
                {
                    field : 'createor',
                    title : '扫描员',
                    formatter: function(value, row, index) {
                        return $.table.selectUserLabel(userDatas, value);
                    }
                },
                {
                    field : 'inputer',
                    title : '补录员'
                },
                {
                    field : 'capturer',
                    title : '当前操作员'
                },
                {
                    field : 'captureTime',
                    title : '操作时间'
                },
                {
                    field : 'status',
                    title : '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field : 'statusCode',
                    title : '特殊状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusCodeDatas, value);
                    }
                },
                {
                    field : 'docNum',
                    title : '流水总数',
                    visible: false
                },
                {
                    field : 'inputTime',
                    title : '补录时间',
                    visible: false
                },
                {
                    field : 'ocrServerId',
                    title : 'OCR服务ID',
                    visible: false
                },
                {
                    field : 'autoMatchServerId',
                    title : '自动勾兑服务ID',
                    visible: false
                },
                {
                    field : 'auditOkNum',
                    title : '已监督总数',
                    visible: false
                },
                {
                    field : 'locker',
                    title : '当前操作员',
                    visible: false
                },
                {
                    field : 'auditOrgCode',
                    title : '监督中心号',
                    visible: false
                },
                {
                    field : 'forceInputer',
                    title : '强制补录员',
                    visible: false
                },
                {
                    field : 'forceInputNum',
                    title : '强补总数',
                    visible: false
                },
                {
                    field : 'forceInputTime',
                    title : '强补时间',
                    visible: false
                },
                {
                    field : 'sort',
                    title : '之前状态',
                    visible: false
                },
                {
                    field : 'previousInputer',
                    title : '之前操作员',
                    visible: false
                },
                {
                    field : 'arcType',
                    title : '批次类型',
                    visible: false
                },
                {
                    field : 'nameCode',
                    title : '复核监督员',
                    visible: false
                },
                {
                    field : 'reScanner',
                    title : '补扫员',
                    visible: false
                },
                {
                    field : 'reScanNum',
                    title : '补扫张数',
                    visible: false
                },
                {
                    field : 'reScanTime',
                    title : '补扫时间',
                    visible: false
                },
                {
                    field : 'reInputer',
                    title : '重补员',
                    visible: false
                },
                {
                    field : 'reInputTime',
                    title : '重补时间',
                    visible: false
                },
                {
                    field : 'backMarkFlag',
                    title : '背面是否已经标记',
                    visible: false
                },
                {
                    field : 'manualInputBNum',
                    title : '背面补录数',
                    visible: false
                },
                {
                    field : 'manualInputNum',
                    title : '补录数',
                    visible: false
                },
                {
                    field : 'forceInputBNum',
                    title : '强补背面数',
                    visible: false
                },
                {
                    field : 'crendId',
                    title : '塑封包',
                    visible: false
                },
                {
                    field : 'inputOrgCode',
                    title : '对应补录中心',
                    visible: false
                },
                {
                    field : 'reAuditor',
                    title : '监督员',
                    visible: false
                },
                {
                    field : 'reAuditTime',
                    title : '监督时间',
                    visible: false
                },
                {
                    field : 'reAuNum',
                    title : '监督量',
                    visible: false
                },
                {
                    field : 'reStatus',
                    title : '监督状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(reStatusDatas, value);
                    },
                    visible: false
                },
                {
                    field : 'name',
                    title : '备注',
                    visible: false
                },
                {
                    field : 'description',
                    title : '补扫说明',
                    visible: false
                },
                {
                    field : 'type',
                    title : '类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(typeDatas, value);
                    },
                    visible: false
                },
                {
                    field : 'indexNo',
                    title : '序号',
                    visible: false
                },
                {
                    field : 'parentId',
                    title : '批次种类',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(parentIdDatas, value);
                    },
                    visible: false
                },

                {
                    field : 'priority',
                    title : '优先级',
                    visible: false
                },
                {
                    field : 'imageNum',
                    title : '影像总数',
                    visible: false
                },
                {
                    field : 'id',
                    title : '主键',
                    visible: false
                },
                {
                    field : 'code',
                    title : '代码',
                    visible: false
                }/*,
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
        };
        $.table.init(options);
    });


    //选择机构
    function selectDeptTree() {
        var treeId = $("#treeId").val();
        var deptId = $.common.isEmpty(treeId) ? "00038" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        if ($.tree.notAllowParents(tree)) {
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            // $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    }

    //解锁批次
    function unlock() {
        $.modal.confirm("确定要为该批次解锁吗？",function () {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            var data={"status":row.status,"id":row.id};
            $.operate.post(prefix+'/unlock',data);
        })
    }

    //回退
    function callBack() {
        $.modal.confirm("确定要回退该批次吗？",function () {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            var data={"status":row.status,"id":row.id};
            $.operate.post(prefix+'/callBack',data);
        })
    }

    //回退至指定人员
    function callBackToUser() {
        var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
        var data={"status":row.status,"buttonType":"callBackToUser"};
        $.operate.post(prefix+"/checkStatus",data,function(result){
            if(result.code!=web_status.SUCCESS){
                $.operate.ajaxSuccess(result);
            } else {
                $.modal.showModalDailog("callBackModel","回退至指定人员");
            }
        })
    }

    function callBackToUserConfirm() {
        $.modal.confirm("确定要回退该批次吗？",function () {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            var data={"status":row.status,"id":row.id,"callBackToInputer":$("#callBackToInputer").val()};
            $.operate.post(prefix+'/callBackToUser',data,function () {
                $("#callBackModel").modal("hide");
                $.table.refresh();
            });
        })

    }

    //重新补录批次
    function reInput() {
        $.modal.confirm("确定将该批次回退到重新补录吗？", function () {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            var data = {"status": row.status, "id": row.id, "inputer": row.inputer};
            $.operate.post(prefix + '/reInput', data);
        })
    }

    //查看补录详情
    function manualInputDetail() {
        if(window.showModalDialog)
        {
            var row = $("#bootstrap-table").bootstrapTable('getSelections')[0];
            ChildWidth = screen.availWidth;
            ChildHeight = screen.availHeight;
            var obj = window.showModalDialog('/sdi/input/manualInputDetail/'+row.id,window,'dialogWidth:'+ ChildWidth +'px;dialogHeight:' + ChildHeight + 'px;center:yes;help:yes;resizable:no;status:yes;scroll:no;');
        }
    }
</script>
</html>